import {
  Column,
  CreateDateColumn,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

export abstract class BaseEntity {
  // primary key
  @PrimaryGeneratedColumn({ type: 'bigint' })
  id: number;

  // delete status
  @Column({ default: false })
  deleteStatus: boolean;

  // create time
  @Column()
  @CreateDateColumn()
  createTime: Date;

  // update time
  @Column()
  @UpdateDateColumn()
  updateTime: Date;

  // creator‘s user id
  @Column({ type: 'bigint', default: 0 })
  createBy: number;

  // user id of last update
  @Column({ type: 'bigint', default: 0 })
  updateBy: number;
}